/*
 * @Description: 菜单路由定义
 * @Author: seadon
 * @LastEditors: seadon
 * @Date: 2021-07-07 10:46:58
 * @LastEditTime: 2022-09-20 10:10:01
 */
import { RouteRecordRaw } from 'vue-router'
// import { t } from '@/entry_mobile/locales'
import { i18n } from '@/locales'
const { $t } = i18n

// 首页
const Home = () =>
	import(/* webpackChunkName: "home" */ '@/entry_mobile/views/Home/index.vue')
const MyTask = () =>
	import(/* webpackChunkName: "home" */ '@/entry_mobile/views/MyTask/index.vue')
const MyApproval = () =>
	import(
		/* webpackChunkName: "home" */ '@/entry_mobile/views/MyApproval/index.vue'
	)
const ApplicationCenter = () =>
	import(
		/* webpackChunkName: "home" */ '@/entry_mobile/views/ApplicationCenter/index.vue'
	)
const PersonalCenter = () =>
	import(
		/* webpackChunkName: "home" */ '@/entry_mobile/views/PersonalCenter/index.vue'
	)
const changeOrg = () =>
	import(
		/* webpackChunkName: "home" */ '@/entry_mobile/views/PersonalCenter/changeOrg/index.vue'
	)
// const AppList = () =>
// 	import(
// 		/* webpackChunkName: "home" */ '@/entry_mobile/views/AppList/index.vue'
// 	)
// const AppSearch = () =>
// 	import(
// 		/* webpackChunkName: "home" */ '@/entry_mobile/views/AppSearch/index.vue'
// 	)
const languageSelect = () =>
	import(
		/* webpackChunkName: "home" */ '@/entry_mobile/views/languageSelect/index.vue'
	)
// const welcomeByteluck = () =>
// 	import(
// 		/* webpackChunkName: "home" */ '@/entry_mobile/views/EnterLoading/index.vue'
// 	)

const routes: Array<RouteRecordRaw> = [
	{
		path: '/',
		name: 'home',
		component: Home,
		meta: {
			title: '',
		},
		children: [
			// {
			// 	path: '/welcome_byteluck',
			// 	name: 'welcome_byteluck',
			// 	component: welcomeByteluck,
			// 	meta: {
			// 		title: '',
			// 	},
			// },
			{
				path: 'my_task',
				name: 'my_task',
				component: MyTask,
				meta: {
					activeTab: 1,
					title: $t('menu.myMission', '我的任务'),
				},
			},
			{
				path: 'my_approval',
				name: 'my_approval',
				component: MyApproval,
				meta: {
					activeTab: 2,
					title: $t('menu.myApplication', '我的申请'),
				},
			},
			{
				path: 'application_center',
				name: 'application_center',
				component: ApplicationCenter,
				meta: {
					activeTab: 3,
					title: $t('menu.applicationCenter', '应用中心'),
				},
			},
			{
				path: 'personal_center',
				name: 'personal_center',
				component: PersonalCenter,
				meta: {
					activeTab: 4,
					title: $t('menu.PersonalCenter', '个人中心'),
				},
			},
			{
				path: 'changeOrg',
				name: 'change_org',
				component: changeOrg,
				meta: {
					title:
						window.location.href.split('labelId=')[1] === ''
							? $t('menu.SwitchOrganization', '组织切换')
							: window.location.href.split('labelId=')[1] === '1'
							? $t('menu.ExecutiveBranch', '行政部门') 
							: $t('menu.BusOrgDepartment', '业务组织部门'),
				},
			},
			{
				path: 'search',
				name: 'search',
				component: MyTask,
				meta: {
					title: $t('menu.search', '搜索'),
				},
			},
			{
				path: 'language_select',
				name: 'language_select',
				component: languageSelect,
				meta: {
					title: $t('menu.LanguageSettings', '语言设置'),
				},
			},
		],
	},
]

export default routes
